//

//  LYRollContentView.m
//  SelectCity
//
//  Created by liuyan on 2019/3/17.
//  Copyright © 2019年 liuyan. All rights reserved.
//

#import "LYRollContentView.h"

#define LEFT_MARGIN 6.0

@interface LYRollContentView ()

@property (nonatomic, weak) UILabel *textLabel;

@end

@implementation LYRollContentView

- (void)setText:(NSString *)text {
    _text = text;
    self.textLabel.text = text;
    [self layoutSubviews];
}

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        UILabel *textLabel = [[UILabel alloc] init];
        textLabel.font = Font(Font_13);
        textLabel.userInteractionEnabled = YES;
        textLabel.textColor = THEMECOLOR_OF_TEXT_333333;
        textLabel.numberOfLines = 2;
        textLabel.lineBreakMode = NSLineBreakByTruncatingTail;
        self.textLabel = textLabel;
        [self addSubview:textLabel];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    CGSize size = self.bounds.size;
    CGFloat textW = size.width - LEFT_MARGIN;
    self.textLabel.frame = CGRectMake(LEFT_MARGIN, 0, textW, size.height);
}

@end
